/**
 * 
 */
package com.yuri.news.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.yuri.news.interceptor.BackInterceptor;

/**
 * @author Administrator
 *
 */
@SuppressWarnings("deprecation")
@Configuration
public class MyInterceptorConfig extends WebMvcConfigurerAdapter {
	private final Logger logger = LoggerFactory.getLogger(BackInterceptor.class);
	@Autowired
	BackInterceptor backInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// addPathPatterns 用于添加拦截规则, 这里假设拦截 /back-stage 后面的全部链接
		// excludePathPatterns 用户排除拦截
		logger.info("\n s");
		registry.addInterceptor(backInterceptor).addPathPatterns("/back-stage/**");
		super.addInterceptors(registry);
	}
}
